home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Animation Wizard.dir / 00003_CheckBox.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  934 b   |  49 lines

  1. property ichCheckBox, iCurrentValue
  2.  
  3. on birth me
  4.   return me
  5. end
  6.  
  7. on mInit me, chCheckBox, defaultValue
  8.   set ichCheckBox to chCheckBox
  9.   puppetSprite(ichCheckBox, 1)
  10.   if voidp(defaultValue) then
  11.     set iCurrentValue to 1
  12.   else
  13.     set iCurrentValue to defaultValue
  14.   end if
  15.   mDraw(me)
  16. end
  17.  
  18. on mDraw me
  19.   global gCastNumCheckBoxOn, gCastNumCheckBoxOff
  20.   if iCurrentValue then
  21.     set the castNum of sprite ichCheckBox to gCastNumCheckBoxOn
  22.   else
  23.     set the castNum of sprite ichCheckBox to gCastNumCheckBoxOff
  24.   end if
  25.   updateStage()
  26. end
  27.  
  28. on mHit me
  29.   set iCurrentValue to not iCurrentValue
  30.   mDraw(me)
  31. end
  32.  
  33. on mGetValue me
  34.   return iCurrentValue
  35. end
  36.  
  37. on mSetValue me, theNewValue
  38.   if (theNewValue <> 1) and (theNewValue <> 0) then
  39.     alert("Bad value passed to mSetValue of CheckBox:" && theNewValue)
  40.     return 
  41.   end if
  42.   set iCurrentValue to theNewValue
  43.   mDraw(me)
  44. end
  45.  
  46. on mCleanUp me
  47.   puppetSprite(ichCheckBox, 0)
  48. end
  49.